﻿//双击事件
function CustomDbClick() {
    //parent.closeWin(); //去掉双击功能
    fnViewYearDetail();
}

var fnCustomAdd = function () {
    return;
}

//修改信息
var fnCustomEdit = function () {
    return;
}

//删除第一步
var fnCustomDelete = function () {
    return;
}


//查看
var fnViewYearDetail = function () {
    //debugger
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    const_EditEntity = "V_wkEmployeeVacationWorkBill";
    //debugger;
    var pagetitle = "查看年假明细—" + record._oData["CName"];
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, encodeURI("../Extend/YUIDataTableList.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&condition=VacationName='年假' and EmployeeCode='" + record._oData["EmployeeCode"] + "' and SUBSTRING(convert(varchar(10),CONVERT (date, BeginWorkDate),110 ),7,4)='" + record._oData["YearName"] + "' and SUBSTRING(convert(varchar(10),CONVERT (date, EndWorkDate),110 ),7,4)='" + record._oData["YearName"] + "' "));
    parent.NeedRefreshPage = this;
}

//手动清零
var fnClear = function () {
    //debugger
    var list = this.mDataTable.getRecordSet()._records;
    var elist = [];
    dl = [];
    for (var i = 0; i < list.length; i++) {
        //this.getRecordSet()._records[0]._oData["BarItem"]
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData[const_entityID]);
            dl.push(list[i]._sId); //获取行ID；
        }
    }
    if (elist.length > 0) {
        var SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=ClearYearVacation&entity=" + const_EditEntity + "&json=" + elist.join(",");
        YAHOO.util.Connect.asyncRequest('POST', SaveUrl, {
            success: function (res) {
                try {
                    var str = res.responseText;
                    if (str == "1") {
                        alert("手动清零成功");
                    }
                    else {
                        alert(str + "\n" + "手动清零失败!");
                    }
                }
                catch (e) {
                }
                finally {
                }
            },
            failure: function (error) {
                alert("手动清零失败，数据错误：" + error.statusText);
            }
        }, null);
    }
    else {
        alert("请至少选择一条记录！")
        return;
    }

    //刷新列表
    ReLoadData();

}

//初始化
if (typeof ($) != "undefined") {
    $(document).ready(function () {

    });
}
